﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sui.Domain;
using Sui.Domain.Repository;

namespace Sui.Domain.App
{
    public class ConnApp:AppBase
    {
        private IConnRepository service = new ConnRepository(conn);
        public DataTable GetDataTable()
        {
            return base.GetDataTable("Conn");
        }
        public List<ConnEntity> GetList()
        {
            return service.FindList("SELECT * FROM Conn order by pid,sort_code asc");
        }

        public int Save(ConnEntity entity)
        {
            if (string.IsNullOrEmpty(entity.id))
            {
                entity.Create();
                return service.Insert(entity);
            }
            else
            {
                entity.Modify(entity.id);
                return service.Update(entity);
            }
        }
        public int Delete(ConnEntity entity)
        {
            return service.Delete(entity);
        }
    }
}
